package com.example.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.pojo.*;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;

/**
 * ClassName:problemMapp
 * Description:
 *
 * @Author 赵永峰
 * @Create 2024/6/13 17:41
 * @Version 1.0
 */
@Mapper
public interface problemMapp {
    //修改问题
    @DS("baodingRussia")
    @Select("update problem set " +
            "workshop=#{workshop}," +
            "drawing=#{drawing}," +
            "op=#{op}," +
            "liability=#{liability}," +
            "liabilityNub=#{liabilityNub}," +
            "occurDate=#{occurDate}," +
            "quantity=#{quantity}," +
            "problemName=#{problemName}," +
            "describeUse=#{describeUse}," +
            "type1=#{type1}," +
            "type2=#{type2} where idUse=#{idUse}")
    void problemAddEdit(problemPojo problemPojo);

    @DS("baodingRussia")
    @Insert("INSERT INTO problem (workshop, drawing, op, occurDate, noteTaker, liability, liabilityNub, problemName, describeUse, quantity, introspection, statusUse, origin, outflow, correct, temporaryUse, permanent, switchDate, switchNumber, correctDate, correctLiability, correctOut, correctResult, correctValidate, temporaryValidate, temporaryResult, temporaryDate, temporaryLiability, temporaryOut, permanentDate, permanentLiability, permanentOut, permanentResult, permanentValidate, introspectionDate, introspectionLiability, introspectionOut, introspectionResult, introspectionValidate,finish, report, type1, type2, establishTime, UpdateTime) " +
            "VALUES (#{workshop}, #{drawing}, #{op}, #{occurDate}, #{noteTaker}, #{liability}, #{liabilityNub}, #{problemName}, #{describeUse}, #{quantity}, #{introspection}, #{statusUse}, #{origin}, #{outflow}, #{correct}, #{temporaryUse}, #{permanent}, #{switchDate}, #{switchNumber}, #{correctDate}, #{correctLiability}, #{correctOut}, #{correctResult}, #{correctValidate}, #{temporaryValidate}, #{temporaryResult}, #{temporaryDate}, #{temporaryLiability}, #{temporaryOut}, #{permanentDate}, #{permanentLiability}, #{permanentOut}, #{permanentResult}, #{permanentValidate}, #{introspectionDate}, #{introspectionLiability}, #{introspectionOut}, #{introspectionResult}, #{introspectionValidate},#{finish},#{report},#{type1},#{type2}, #{establishTime}, #{UpdateTime})")
    void insertOne(problemPojo problemPojo);
    //加载时，查询所有的问题
    @DS("baodingRussia")
    @Select("select * from problem")
    List<problemPojo> problemAllList();
    //根据ID，向数据库中写入代码(文本类）。
    @DS("baodingRussia")
    @Select("update problem set ${field}=#{val} where idUse=#{idUse}")
    void upDataField(Integer idUse, String field, String val);
    //根据ID，向数据库中写入代码(数字类）。
    @DS("baodingRussia")
    @Select("update problem set ${field}=#{val},UpdateTime=#{uptime} where idUse=#{idUse}")
    void upDataFieldNmb(Integer idUse, String field, Integer val, LocalDateTime uptime);
    //用户要查找需要汇报的项目
    @DS("baodingRussia")
    @Select("select * from problem where report='是'")
    List<problemPojo> problemAllListType1();

    //按照录入日期查询根据不同的条件，有是不是我自己的，是不是未结题的，然后是那天录入的，现在查询的都是我自己的
    @DS("baodingRussia")
    @Select("select * from problem where liabilityNub like concat('%',#{isMy},'%') and finish=#{isEnd} and date_format(establishTime,'%Y-%m-%d')=#{isDate}")
    List<problemPojo> problemInputDateQueryIsMy(String isMy, String isEnd, String isDate);
    //查找我自己下所有的项目
    @DS("baodingRussia")
    @Select("select * from problem where liabilityNub like concat('%',#{isMy},'%') and date_format(establishTime,'%Y-%m-%d')=#{isDate}")
    List<problemPojo> problemInputDateQueryIsMyAll(String isMy, String isDate);
    //修改一个字段内容，并且把修改时间改掉
    @DS("baodingRussia")
    @Update("update problem set ${fieldName}=#{val},UpdateTime=#{uptime} where idUse=#{id}")

    void upDataOneField(Integer id, String fieldName, String val, LocalDateTime uptime);
    //按照录入日期筛选，全部的，区别为是否结题
    @DS("baodingRussia")
    @Select("select * from problem where finish=#{isEnd} and date_format(establishTime,'%Y-%m-%d')=#{isDate}")
    List<problemPojo> problemInputDateQueryAll(String isEnd, String isDate);
    //按照录入日期筛选，全部问题
    @DS("baodingRussia")
    @Select("select * from problem where date_format(establishTime,'%Y-%m-%d')=#{isDate}")
    List<problemPojo> problemInputDateQueryIsDate(String isDate);
    //从新问题库中，查询某一个字段，等于多个值的数据(是查询字符串）
    @DS("newMscLowCodeFormal")
    @Select("select * from problem_data where (${filedName}=#{firstFiledVal} or ${filedName}=#{secondFiledVal} or ${filedName}=#{threeFiledVal} or ${filedName}=#{fourthFiledVal} or ${filedName}=#{fifthFiledVal})  and deleteSign=1")
    List<problemDataPojo> inquiryProblemOneFindSeveralVal(String filedName, String firstFiledVal, String secondFiledVal, String threeFiledVal, String fourthFiledVal, String fifthFiledVal);
    //修改新问题库中的某一行，修改所有的字段
    @DS("newMscLowCodeFormal")
    @Update("UPDATE problem_data SET " +
            "establishTime=#{establishTime}, " +
            "updateTime=#{updateTime}, " +
            "deleteSign=#{deleteSign}, " +
            "editName=#{editName}, " +
            "workshop=#{workshop}, " +
            "lineName=#{lineName}, " +
            "drawing=#{drawing}, " +
            "op=#{op}, " +
            "occurDate=#{occurDate}, " +
            "noteTaker=#{noteTaker}, " +
            "liability=#{liability}, " +
            "liabilityNub=#{liabilityNub}, " +
            "problemName=#{problemName}, " +
            "describeUse=#{describeUse}, " +
            "describeAnnex=#{describeAnnex}, " +
            "quantity=#{quantity}, " +
            "introspection=#{introspection}, " +
            "statusUse=#{statusUse}, " +
            "origin=#{origin}, " +
            "outflow=#{outflow}, " +
            "temporaryUse=#{temporaryUse}, " +
            "correct=#{correct}, " +
            "switchDate=#{switchDate}, " +
            "switchNumber=#{switchNumber}, " +
            "correctDate=#{correctDate}, " +
            "temporaryDate=#{temporaryDate}, " +
            "temporaryLiability=#{temporaryLiability}, " +
            "permanentDate=#{permanentDate}, " +
            "permanentLiability=#{permanentLiability}, " +
            "introspectionDate=#{introspectionDate}, " +
            "introspectionLiability=#{introspectionLiability}, " +
            "conclusion=#{conclusion}, " +
            "finish=#{finish}, " +
            "report=#{report}, " +
            "type1=#{type1}, " +
            "correctOut=#{correctOut}, " +
            "type2=#{type2}, " +
            "machinePlateName=#{machinePlateName}, " +
            "machinePlateId=#{machinePlateId}, " +
            "peoplePlateName=#{peoplePlateName}, " +
            "peoplePlateId=#{peoplePlateId}, " +
            "materialPlateName=#{materialPlateName}, " +
            "materialPlateId=#{materialPlateId}, " +
            "methodPlateName=#{methodPlateName}, " +
            "methodPlateId=#{methodPlateId}, " +
            "environmentPlateName=#{environmentPlateName}, " +
            "environmentPlateId=#{environmentPlateId}, " +
            "measurePlateName=#{measurePlateName}, " +
            "measurePlateId=#{measurePlateId}, " +
            "correctLiability=#{correctLiability}, " +
            "permanent=#{permanent}, " +
            "writeName=#{writeName}, " +
            "examineName=#{examineName}, " +
            "approveName=#{approveName}, " +
            "liabilityName=#{liabilityName}, " +
            "isIndemnify=#{isIndemnify}, " +
            "isEndIndemnify=#{isEndIndemnify}, " +
            "supplierName=#{supplierName}, " +
            "isExam=#{isExam}, " +
            "saleDate=#{saleDate}, " +
            "mileage=#{mileage}," +
            "partName=#{partName}, " +
            "failureType=#{failureType}"+
            " WHERE id=#{id}")
    void editOneAll(problemDataPojo pojo);

    //批量对问题索赔单的数据进行插入
    @DS("newMscLowCodeFormal")
    void insertWarrantyList(List<warrantyClaimsPojo> warrantyClaimsPojoList);
    @DS("newMscLowCodeFormal")
    void insertWarrantyListCBU(List<warrantyClaimsCBUPojo> warrantyClaimsCBUPojoList);
    @DS("newMscLowCodeFormal")
    void insertWarrantyListKD(List<warrantyClaimsKDPojo> warrantyClaimsKDPojoList);

    //查询出所有的索赔信息
    @DS("newMscLowCodeFormal")
    @Select("select * from warranty_claims where deleteSign=1")
    List<warrantyClaimsPojo> inquiryWarrantyClaimAll();
    @DS("newMscLowCodeFormal")
    @Select("select * from ddm_warranty_claims_CBU where sys_deleted=0")
    List<warrantyClaimsCBUPojo> inquiryWarrantyClaimCBUAll();
    @DS("newMscLowCodeFormal")
    @Select("select * from ddm_warranty_claims_KD where sys_deleted=0")
    List<warrantyClaimsKDPojo> inquiryWarrantyClaimKDAll();

    //辅助函数，对售后索赔单的字段进行修改，根据id，修改多个字段，字段名称需要按照‘/’隔开，val也是一样的，并且需要和字段对应
    @DS("newMscLowCodeFormal")
    @Update("update warranty_claims set ${filedName}=#{filedVal} where id=#{id}")
    void editWarrantyClaimOneField(int id,String filedName, String filedVal);
    @DS("newMscLowCodeFormal")
    @Update("update ddm_warranty_claims_CBU set ${filedName}=#{filedVal} where id=#{id}")
    void editWarrantyClaimCBUOneField(String id,String filedName, String filedVal);
    @DS("newMscLowCodeFormal")
    @Update("update ddm_warranty_claims_KD set ${filedName}=#{filedVal} where id=#{id}")
    void editWarrantyClaimKDOneField(String id,String filedName, String filedVal);

    //辅助函数，根据id，向后端进行筛选问题库所有的数据
    @DS("newMscLowCodeFormal")
    @Select("SELECT * FROM problem_data WHERE id=#{id} and deleteSign=1 LIMIT 1")
    problemDataPojo inquiryProblemById(Integer id);

    //辅助函数，在索赔单中，查询出所有的IPTV问题，通过一个IPTV类型，找到所有不为空的数据
    @DS("newMscLowCodeFormal")
    @Select("select * from warranty_claims where ${filedName} IS NOT NULL AND TRIM(${filedName}) != '' and TRIM(${filedName}) != '-' and deleteSign=1")
    List<warrantyClaimsPojo> inquiryWarrantyClaimOneFiledNoVoid(String filedName);
    @DS("newMscLowCodeFormal")
    @Select("select * from ddm_warranty_claims_CBU where ${filedName} IS NOT NULL AND TRIM(${filedName}) != '' and TRIM(${filedName}) != '-' and sys_deleted=O")
    List<warrantyClaimsCBUPojo> inquiryWarrantyClaimCBUOneFiledNoVoid(String filedName);
    @DS("newMscLowCodeFormal")
    @Select("select * from ddm_warranty_claims_KD where ${filedName} IS NOT NULL AND TRIM(${filedName}) != '' and TRIM(${filedName}) != '-' and sys_deleted=O")
    List<warrantyClaimsKDPojo> inquiryWarrantyClaimKDOneFiledNoVoid(String filedName);

    //在索赔列表中，查询一个字段等于某一个值
    @DS("newMscLowCodeFormal")
    @Select("select * from warranty_claims where deleteSign=1 and ${filedName}=#{s}")
    List<warrantyClaimsPojo> inquiryWarrantyClaimOneFiled(String filedName, String s);
    @DS("newMscLowCodeFormal")
    @Select("select * from ddm_warranty_claims_CBU where sys_deleted=0 and ${filedName}=#{s}")
    List<warrantyClaimsCBUPojo> inquiryWarrantyClaimCBUOneFiled(String filedName, String s);
    @DS("newMscLowCodeFormal")
    @Select("select * from ddm_warranty_claims_KD where sys_deleted=0 and ${filedName}=#{s}")
    List<warrantyClaimsKDPojo> inquiryWarrantyClaimKDOneFiled(String filedName, String s);

    //辅助函数，在索赔单中，根据一个字段，查询出这个字段等于某一个值或者多个字的数据，值需要用’/‘隔开，用在查询int格式上
    @DS("newMscLowCodeFormal")
    @Select("select * from warranty_claims where deleteSign=1 and ${filedName}=#{parseInt}")
    List<warrantyClaimsPojo> inquiryWarrantyClaimOneFiledInt(String filedName, int parseInt);
    //辅助函数：调取所有的不良品信息
    @DS("newMscLowCodeFormal")
    @Select("select * from bhgpczdzb")
    List<noGoodPartAssPojo> inquiryNoGoodPartAll();
    //辅助函数：向后端的不合格品库中写入代码，需要写入多个字段
    @DS("newMscLowCodeFormal")
    @Update("update bhgpczdzb set ${s}=#{s1} where id=#{id}")
    void editNoGoodDataOneField(String id, String s, String s1);

    //辅助函数：修改索赔单中的int类型的数据
    @DS("newMscLowCodeFormal")
    @Update("update warranty_claims set ${s}=#{parseInt} where id=#{id}")
    void editWarrantyClaimOneFieldInt(Integer id, String s, int parseInt);
    @DS("newMscLowCodeFormal")
    @Update("update ddm_warranty_claims_CBU set ${s}=#{parseInt} where id=#{id}")
    void editWarrantyClaimCBUOneFieldInt(String id, String s, int parseInt);
    @DS("newMscLowCodeFormal")
    @Update("update ddm_warranty_claims_KD set ${s}=#{parseInt} where id=#{id}")
    void editWarrantyClaimKDOneFieldInt(String id, String s, int parseInt);

    //辅助函数：查询零公里所有的数据
    @DS("newMscLowCodeFormal")
    @Select("select * from zero_kilometers_data where deleteSign=1")
    List<zeroKilometersPojo> inquiryZeroKilometersAll();
    //辅助函数，对零公里的清单中，插入一行数据
    @DS("newMscLowCodeFormal")
    @Insert("INSERT INTO zero_kilometers_data SET " +
            "establishTime = #{establishTime}, " +
            "updateTime = #{updateTime}, " +
            "deleteSign = #{deleteSign}, " +
            "editName = #{editName}, " +
            "occurDate = #{occurDate}, " +
            "engineType = #{engineType}, " +
            "engineNo = #{engineNo}, " +
            "describeUse = #{describeUse}, " +
            "quantity = #{quantity}, " +
            "detailed = #{detailed}, " +
            "placeProduction = #{placeProduction}, " +
            "responsibleParty = #{responsibleParty}, " +
            "isExam = #{isExam}," +
            "typeUse=#{typeUse}," +
            "partName=#{partName}," +
            "problemType=#{problemType}," +
            "problemId=#{problemId}," +
            "mileage=#{mileage}," +
            "workshop=#{workshop}," +
            "line=#{line}," +
            "op=#{op}," +
            "equipmentName=#{equipmentName}," +
            "shutdownStartTime=#{shutdownStartTime}, " +
            "shutdownEndTime=#{shutdownEndTime}," +
            "shutdownDuration=#{shutdownDuration}, " +
            "lineStopDuration=#{lineStopDuration}")
    void inertZeroKilometersOne(zeroKilometersPojo pojo);
    //辅助函数，对零公里清单中（记录的不是零公里，是所有的问题），根据一个字段，查询等于该字段的所有数据,是字符串的
    @DS("newMscLowCodeFormal")
    @Select("select * from zero_kilometers_data where ${fieldName}=#{fieldVal} and deleteSign=1")
    List<zeroKilometersPojo> inquiryOneFieldZeroKilometers(String fieldName,String fieldVal);
    //修改一个过程清单的一个字段，是字符串类型
    @DS("newMscLowCodeFormal")
    @Update("update zero_kilometers_data set ${s}=#{s1} where id=#{id}")
    void editZeroKilometersField(Integer id, String s, String s1);
    //修改一个过程清单的一个字段，是字符串类型
    @DS("newMscLowCodeFormal")
    @Update("update zero_kilometers_data set ${s}=#{parseInt} where id=#{id}")
    void editZeroKilometersFieldInt(Integer id, String s, int parseInt);
    //辅助函数：对不良品库中，根据一个字段，查询这个字段等于某一值，可以等于多个值，每个值中间有‘/’隔开；配的是类型；
    @DS("newMscLowCodeFormal")
    @Select("select * from bhgpczdzb where ${filedName}=#{s} and sys_deleted=0")
    List<noGoodPartAssPojo> inquiryNoGoodFiledSeveral(String filedName, String s);
    //辅助函数：向后端IPTV报告中筛选数据，可以实现筛选多个等段同时等于多个数值，最多可以为10个。
    @DS("newMscLowCodeFormal")
    @Select("select * from iptv_report_data where ${filedName1}=#{filedVal1} and deleteSign=1")
    List<iptvReportDataPojo> inquiryIptvReportField1(String filedName1, String filedVal1);
    @DS("newMscLowCodeFormal")
    @Select("select * from iptv_report_data where ${filedName1}=#{filedVal1} and ${filedName2}=#{filedVal2} and deleteSign=1")
    List<iptvReportDataPojo> inquiryIptvReportField2(String filedName1, String filedVal1,String filedName2, String filedVal2);
    @DS("newMscLowCodeFormal")
    @Select("select * from iptv_report_data where ${filedName1}=#{filedVal1} and ${filedName2}=#{filedVal2} and ${filedName3}=#{filedVal3} and deleteSign=1")
    List<iptvReportDataPojo> inquiryIptvReportField3(String filedName1, String filedVal1,String filedName2, String filedVal2,String filedName3, String filedVal3);
    @DS("newMscLowCodeFormal")
    @Select("select * from iptv_report_data where ${filedName1}=#{filedVal1} and ${filedName2}=#{filedVal2} and ${filedName3}=#{filedVal3}  and ${filedName4}=#{filedVal4} and deleteSign=1")
    List<iptvReportDataPojo> inquiryIptvReportField4(String filedName1, String filedVal1,String filedName2, String filedVal2,String filedName3, String filedVal3,String filedName4, String filedVal4);
    //插入一行IPTV报告，所有的字段都插入
    @DS("newMscLowCodeFormal")
    @Insert("insert iptv_report_data (" +
            "editName, indicatorType, yearData, " +
            "moonDate, engineType, targetName, " +
            "yearTargetVal, moonNumber, moonSample, " +
            "moonTargetVal, moonAchieve, addUpTargetVal, " +
            "addUpAchieve, moonAchieveRatio, yearAchieveRatio, " +
            "isAchieve, achieveTrend, examNumb, " +
            "information, deleteSign, establishTime, " +
            "updateTime)" +
            " VALUES (" +
            "#{editName}, #{indicatorType}, #{yearData}, " +
            "#{moonDate}, #{engineType}, #{targetName}, " +
            "#{yearTargetVal}, #{moonNumber}, #{moonSample}, " +
            "#{moonTargetVal}, #{moonAchieve}, #{addUpTargetVal}, " +
            "#{addUpAchieve}, #{moonAchieveRatio}, #{yearAchieveRatio}, " +
            "#{isAchieve}, #{achieveTrend}, #{examNumb}, " +
            "#{information}, #{deleteSign}, #{establishTime}, " +
            "#{updateTime})")
    void insertOneIptvReport(iptvReportDataPojo pojo);
    //根据id，修改IptvReport中所有的数据
    @DS("newMscLowCodeFormal")
    @Update("UPDATE iptv_report_data SET " +
            "establishTime = #{establishTime}, " +
            "updateTime = #{updateTime}, " +
            "deleteSign = #{deleteSign}, " +
            "editName = #{editName}, " +
            "indicatorType = #{indicatorType}, " +
            "yearData = #{yearData}, " +
            "moonDate = #{moonDate}, " +
            "engineType = #{engineType}, " +
            "targetName = #{targetName}, " +
            "yearTargetVal = #{yearTargetVal}, " +
            "moonNumber = #{moonNumber}, " +
            "moonSample = #{moonSample}, " +
            "moonTargetVal = #{moonTargetVal}, " +
            "moonAchieve = #{moonAchieve}, " +
            "addUpTargetVal = #{addUpTargetVal}, " +
            "addUpAchieve = #{addUpAchieve}, " +
            "moonAchieveRatio = #{moonAchieveRatio}, " +
            "yearAchieveRatio = #{yearAchieveRatio}, " +
            "isAchieve = #{isAchieve}, " +
            "achieveTrend = #{achieveTrend}, " +
            "examNumb = #{examNumb}, " +
            "information = #{information} " +
            "WHERE id = #{id}")
    void editOneLineIptvReport(iptvReportDataPojo pojo);
    //辅助函数：向后端IPTV报告中查询所有的数据
    @DS("newMscLowCodeFormal")
    @Select("select * from iptv_report_data where deleteSign=1")
    List<iptvReportDataPojo> inquiryIptvReportAll();
    //辅助函数，对零公里清单中（记录的不是零公里，是所有的问题），修改一行所有的数据
    @DS("newMscLowCodeFormal")
    @Update("UPDATE zero_kilometers_data " +
            "SET " +
            "  establishTime = #{establishTime}, " +
            "  updateTime = #{updateTime}, " +
            "  deleteSign = #{deleteSign}, " +
            "  editName = #{editName}, " +
            "  occurDate = #{occurDate}, " +
            "  engineType = #{engineType}, " +
            "  engineNo = #{engineNo}, " +
            "  describeUse = #{describeUse}, " +
            "  quantity = #{quantity}, " +
            "  detailed = #{detailed}, " +
            "  placeProduction = #{placeProduction}, " +
            "  responsibleParty = #{responsibleParty}, " +
            "  isExam = #{isExam}, " +
            "  typeUse = #{typeUse}, " +
            "  partName = #{partName}, " +
            "  problemType = #{problemType}, " +
            "  problemId = #{problemId}, " +
            "  mileage = #{mileage}," +
            "  workshop=#{workshop}," +
            "  line=#{line}, " +
            "  op=#{op}, " +
            "  equipmentName=#{equipmentName}, " +
            "  shutdownDuration=#{shutdownDuration}, " +
            "  shutdownEndTime=#{shutdownEndTime}, " +
            "  shutdownDuration=#{shutdownDuration}, " +
            "  lineStopDuration=#{lineStopDuration} " +
            "WHERE id = #{id}")
    void editZeroKilometersOneAllById(zeroKilometersPojo pojo);
    //辅助函数，对零公里清单中（记录的不是零公里，是所有的问题），根据一个字段，查询等于该字段的所有数据,是整数型的，主要用于int
    @DS("newMscLowCodeFormal")
    @Select("select * from zero_kilometers_data where ${fieldName}=#{fieldVal}")
    List<zeroKilometersPojo> inquiryOneFieldZeroKilometersInt(String fieldName, Integer fieldVal);
    //辅助函数，在索赔单中，根据一个字段，查询这个字段的一个范围,用在查询字符串类型的，主要用在了查询文本格式保存的时间上

    @DS("newMscLowCodeFormal")
    @Select("select * from warranty_claims where ${filedName}>=#{minVal} and ${filedName}<#{maxVal}")
    List<warrantyClaimsPojo> inquiryWarrantyClaimOneFiledScope(String filedName, String minVal, String maxVal);
    //辅助函数，在不良品记录表中，查询有多少条数据
    @DS("newMscLowCodeFormal")
    @Select("SELECT COUNT(*) FROM bhgpczdzb")
    Integer inquiryNoGoodPartTotal();
    //辅助函数：对不良品筛选，页数、每页最大数，按照输入的字段排倒序进行筛选
    @DS("newMscLowCodeFormal")
    @Select("SELECT * FROM bhgpczdzb ORDER BY create_time DESC limit #{pageSize} offset #{startPage}")
    List<noGoodPartAssPojo> inquiryPaginationNoGoodPart(int startPage, int pageSize);

    //辅助函数：向后端查询售后索赔单有分析中的总数
    @DS("newMscLowCodeFormal")
    @Select("SELECT COUNT(*) FROM warranty_claims where isAnalyzeEnd='ing'and deleteSign=1")
    Integer queryAnalyzingQuantity();
    //辅助函数：向后端查询售后索赔单有多少条数据
    @DS("newMscLowCodeFormal")
    @Select("SELECT COUNT(*) FROM warranty_claims where deleteSign=1")
    Integer inquiryWarrantyClaimTotal();
    //辅助函数：对索赔单（俄动力）筛选，页数、每页最大数，按照输入的字段排倒序进行筛选
    @DS("newMscLowCodeFormal")
    @Select("SELECT * FROM warranty_claims where deleteSign=1 ORDER BY establishTime DESC limit #{pageSize} offset #{startPage}")
    List<warrantyClaimsPojo> inquiryPaginationWarrantyClaim(int startPage, int pageSize);
    //辅助函数：向后端查询CBU售后索赔单有多少条数据
    @DS("newMscLowCodeFormal")
    @Select("SELECT COUNT(*) FROM ddm_warranty_claims_CBU where sys_deleted=0")
    Integer inquiryWarrantyClaimCBUTotal();
    //辅助函数：对CBU索赔单（俄动力）筛选，页数、每页最大数，按照输入的字段排倒序进行筛选
    @DS("newMscLowCodeFormal")
    @Select("SELECT * FROM ddm_warranty_claims_CBU where sys_deleted=0 ORDER BY create_time DESC limit #{pageSize} offset #{startPage}")
    List<warrantyClaimsCBUPojo> inquiryPaginationWarrantyClaimCBU(int startPage, int pageSize);
    //辅助函数：向后端查询KD售后索赔单有多少条数据
    @DS("newMscLowCodeFormal")
    @Select("SELECT COUNT(*) FROM ddm_warranty_claims_KD where sys_deleted=0")
    Integer inquiryWarrantyClaimKDTotal();
    //辅助函数：对KD索赔单（俄动力）筛选，页数、每页最大数，按照输入的字段排倒序进行筛选
    @DS("newMscLowCodeFormal")
    @Select("SELECT * FROM ddm_warranty_claims_KD where sys_deleted=0 ORDER BY create_time DESC limit #{pageSize} offset #{startPage}")
    List<warrantyClaimsKDPojo> inquiryPaginationWarrantyClaimKD(int startPage, int pageSize);

    //修改售后索赔单中是否返件字段
    @DS("newMscLowCodeFormal")
    @Update("update warranty_claims " +
            "set " +
            "updateTime=#{updateTime}, " +
            "isBack=#{isBack} " +
            "where id=#{id}")
    void editOneById(warrantyClaimsPojo pojo);
    @DS("newMscLowCodeFormal")
    @Update("update ddm_warranty_claims_CBU " +
            "set " +
            "update_time=#{update_time}, " +
            "isBack=#{isBack} " +
            "where id=#{id}")
    void editOneByIdCBU(warrantyClaimsCBUPojo pojo);
    @DS("newMscLowCodeFormal")
    @Update("update ddm_warranty_claims_KD " +
            "set " +
            "update_time=#{update_time}, " +
            "isBack=#{isBack} " +
            "where id=#{id}")
    void editOneByIdKD(warrantyClaimsKDPojo pojo);
    @DS("newMscLowCodeFormal")
    @Update("update warranty_claims " +
            "set " +
            "updateTime=#{updateTime}, " +
            "isAnalyzeEnd=#{isAnalyzeEnd} " +
            "where id=#{id}")
    void editIsAnalyzeEnd(warrantyClaimsPojo pojo);
    @DS("newMscLowCodeFormal")
    @Update("update warranty_claims " +
            "set " +
            "updateTime=#{updateTime}, " +
            "isReport=#{isReport} " +
            "where id=#{id}")
    void editIsReport(warrantyClaimsPojo pojo);

    //筛选用户只选择了月份的所有iptv
    @DS("newMscLowCodeFormal")
    @Select("SELECT * FROM warranty_claims where IPTV3=#{iptvVal} or IPTV12=#{iptvVal} or IPTV24=#{iptvVal} and deleteSign=1 ORDER BY establishTime DESC")
    List<warrantyClaimsPojo> filterWarrantyClaimIptv(Integer startPage, Integer pageSize, String iptvVal);

    //筛选索赔单中多个筛选变量的总数
    @DS("newMscLowCodeFormal")
    @Select("SELECT COUNT(*) FROM warranty_claims where IPTV3=#{iptvVal} or IPTV12=#{iptvVal} or IPTV24=#{iptvVal} and deleteSign=1")
    Integer filterWarrantyClaimIptvQuantity(int startPage, Integer pageSize, String iptvVal);

    //筛选某一个iptv下所有数据
    @DS("newMscLowCodeFormal")
    @Select("SELECT * FROM warranty_claims where ${iptvType}!='-' and deleteSign=1 ORDER BY establishTime DESC")
    List<warrantyClaimsPojo> filterWarrantyClaimIptvOne(String iptvType);

    //查某一个iptv等于某值的数
    @DS("newMscLowCodeFormal")
    @Select("SELECT * FROM warranty_claims where ${iptvType}=#{iptvVal} and deleteSign=1 ORDER BY establishTime DESC")
    List<warrantyClaimsPojo> filterWarrantyClaimIptvValue(String iptvType, String iptvVal);

    //查是否考核为某值的数据
    @DS("newMscLowCodeFormal")
    @Select("SELECT * FROM warranty_claims where ${iptvType}!='-' and isExam=#{isAssessment} and deleteSign=1 ORDER BY establishTime DESC")
    List<warrantyClaimsPojo> filterWarrantyClaimIptvOneIs(String iptvType, String isAssessment);

    //筛选索赔单中多个筛选变量Engine
    @DS("newMscLowCodeFormal")
    @Select("SELECT * FROM warranty_claims where engineNo=#{engineNoSelect} and deleteSign=1 ORDER BY establishTime DESC")
    List<warrantyClaimsPojo> filterWarrantyClaimsEngine(String engineNoSelect, int startPage, Integer pageSize);
    //筛选索赔单中多个筛选变量的总数Engine
    @DS("newMscLowCodeFormal")
    @Select("SELECT COUNT(*) FROM warranty_claims where engineNo=#{engineNoSelect} and deleteSign=1")
    Integer filterWarrantyClaimsQuantityEngine(String engineNoSelect);

    //筛选索赔单中多个筛选变量drawingSelect
    @DS("newMscLowCodeFormal")
    @Select("SELECT * FROM warranty_claims where mainPartCode=#{drawingSelect} and deleteSign=1 ORDER BY establishTime DESC LIMIT #{startPage}, #{pageSize}")
    List<warrantyClaimsPojo> filterWarrantyClaimsParts(String drawingSelect, int startPage, Integer pageSize);
    //筛选索赔单中多个筛选变量的总数drawingSelect
    @DS("newMscLowCodeFormal")
    @Select("SELECT COUNT(*) FROM warranty_claims where mainPartCode=#{drawingSelect} and deleteSign=1")
    Integer filterWarrantyClaimsQuantityParts(String drawingSelect);

    //筛选索赔单中多个筛选变量ClaimNumber
    @DS("newMscLowCodeFormal")
    @Select("SELECT * FROM warranty_claims where claimNo=#{claimNumber} and deleteSign=1 ORDER BY establishTime DESC")
    List<warrantyClaimsPojo> filterWarrantyClaimsClaimNumber(String claimNumber, int startPage, Integer pageSize);
    //筛选索赔单中多个筛选变量的总数ClaimNumber
    @DS("newMscLowCodeFormal")
    @Select("SELECT COUNT(*) FROM warranty_claims where claimNo=#{claimNumber} and deleteSign=1 LIMIT #{startPage}, #{pageSize}")
    Integer filterWarrantyClaimsQuantityClaimNumber(String claimNumber);

    //筛选索赔单中多个筛选变量IsAnalyzeEnd
    @DS("newMscLowCodeFormal")
    @Select("SELECT * FROM warranty_claims where isAnalyzeEnd=#{isAnalyzeEnd} and deleteSign=1 ORDER BY establishTime DESC LIMIT #{startPage}, #{pageSize}")
    List<warrantyClaimsPojo> filterWarrantyClaimsIsAnalyzeEnd(String isAnalyzeEnd, int startPage, Integer pageSize);
    //筛选索赔单中多个筛选变量的总数IsAnalyzeEnd
    @DS("newMscLowCodeFormal")
    @Select("SELECT COUNT(*) FROM warranty_claims where isAnalyzeEnd=#{isAnalyzeEnd} and deleteSign=1")
    Integer filterWarrantyClaimsQuantityIsAnalyzeEnd(String isAnalyzeEnd);

    //筛选索赔单中多个筛选变量IsReport
    @DS("newMscLowCodeFormal")
    @Select("SELECT * FROM warranty_claims where isReport=#{isReport} and deleteSign=1 ORDER BY establishTime DESC LIMIT #{startPage}, #{pageSize}")
    List<warrantyClaimsPojo> filterWarrantyClaimsIsReport(String isReport, int startPage, Integer pageSize);
    //筛选索赔单中多个筛选变量的总数IsReport
    @DS("newMscLowCodeFormal")
    @Select("SELECT COUNT(*) FROM warranty_claims where isReport=#{isReport} and deleteSign=1")
    Integer filterWarrantyClaimsQuantityIsReport(String isReport);

    //在返件清单页面搜索索赔单、CBU、KD中的索赔编号
    @DS("newMscLowCodeFormal")
    // 搜索 warranty_claims 表
    @Select("SELECT * FROM warranty_claims where ${fieldName}=#{fieldValue} and deleteSign=1")
    List<warrantyClaimsPojo> searchClaimNumber(String fieldName, String fieldValue);
    // 搜索 ddm_warranty_claims_CBU 表
    @DS("newMscLowCodeFormal")
    @Select("SELECT * FROM ddm_warranty_claims_CBU where ${fieldName}=#{fieldValue} and sys_deleted=0")
    List<warrantyClaimsCBUPojo> searchClaimNumberCBU(String fieldName, String fieldValue);
    // 搜索 ddm_warranty_claims_KD 表
    @DS("newMscLowCodeFormal")
    @Select("SELECT * FROM ddm_warranty_claims_KD where ${fieldName}=#{fieldValue} and sys_deleted=0")
    List<warrantyClaimsKDPojo> searchClaimNumberKD(String fieldName, String fieldValue);

    //查询所有索赔单数据CBU
    @DS("newMscLowCodeFormal")
    @Select("Select * from warranty_claims where deleteSign=1")
    List<warrantyClaimsPojo> queryAll();
    //查询所有索赔单数据CBU
    @DS("newMscLowCodeFormal")
    @Select("Select * from ddm_warranty_claims_CBU where sys_deleted=0")
    List<warrantyClaimsCBUPojo> queryAllCBU();
    //查询所有索赔单数据KD
    @DS("newMscLowCodeFormal")
    @Select("Select * from ddm_warranty_claims_KD where sys_deleted=0")
    List<warrantyClaimsKDPojo> queryAllKD();

    //查找问题清单对应索赔单中的零部件编号
    @DS("newMscLowCodeFormal")
    @Select("select * from problem_data where SUBSTRING_INDEX(drawing, '/', 1) = #{mainPartCode} and deleteSign=1")
    List<problemDataPojo> inquiryProblemByDrawingPart(String mainPartCode);

    //删除问题清单问题明细中某条关联索赔单的数据（修改两个字段）
    @DS("newMscLowCodeFormal")
    @Update("update warranty_claims set ${fieldName1}=#{fieldValue1}, ${fieldName2}=#{fieldValue2} where id=#{id}")
    void editTwoFields(Integer id, String fieldName1, String fieldValue1, String fieldName2, String fieldValue2);
}
